<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单发货</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #1989fa;
            --bg-color: #f5f5f5;
            --card-bg: #fff;
            --text-color: #333;
            --border-color: #eee;
            --success-color: #52c41a;
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: var(--bg-color);
            color: var(--text-color);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        .header {
            padding: 15px;
            background-color: var(--primary-color);
            color: white;
            display: flex;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 100;
        }
        .back-btn {
            background: none;
            border: none;
            color: white;
            padding: 0 15px;
            font-size: 16px;
            cursor: pointer;
        }
        .header-title {
            flex: 1;
            text-align: center;
            font-size: 18px;
            margin-right: 45px;
        }
        .main-content {
            flex: 1;
            padding: 15px;
        }
        .order-info {
            background: white;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 15px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .section-title {
            font-size: 15px;
            font-weight: 500;
            margin-bottom: 12px;
            color: #333;
        }
        .info-item {
            display: flex;
            margin-bottom: 8px;
            font-size: 14px;
            line-height: 1.5;
        }
        .info-label {
            color: #666;
            width: 70px;
            flex-shrink: 0;
        }
        .info-value {
            flex: 1;
            color: #333;
        }
        .shipping-form {
            background: white;
            border-radius: 8px;
            padding: 15px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
        .form-group {
            margin-bottom: 15px;
        }
        .form-label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            color: #333;
        }
        .form-input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 14px;
            box-sizing: border-box;
        }
        .form-input:focus {
            outline: none;
            border-color: var(--primary-color);
        }
        .form-select {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 14px;
            background-color: white;
        }
        .submit-btn {
            width: 100%;
            padding: 12px;
            background-color: var(--primary-color);
            color: white;
            border: none;
            border-radius: 4px;
            font-size: 16px;
            cursor: pointer;
            margin-top: 20px;
        }
        .submit-btn:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }
    </style>
</head>
<body>
    <div class="header">
        <button class="back-btn" onclick="history.back()">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="header-title">订单发货</div>
    </div>

    <div class="main-content">
        <div class="order-info">
            <div class="section-title">订单信息</div>
            <div class="info-item">
                <span class="info-label">订单编号：</span>
                <span class="info-value" id="orderNumber">2025063002</span>
            </div>
            <div class="info-item">
                <span class="info-label">收货人：</span>
                <span class="info-value">张三</span>
            </div>
            <div class="info-item">
                <span class="info-label">联系电话：</span>
                <span class="info-value">138****8888</span>
            </div>
            <div class="info-item">
                <span class="info-label">收货地址：</span>
                <span class="info-value">广东省深圳市南山区科技园南区8栋3单元303室</span>
            </div>
        </div>

        <div class="shipping-form">
            <div class="section-title">发货信息</div>
            <form id="shipForm" onsubmit="handleSubmit(event)">
                <div class="form-group">
                    <label class="form-label">快递公司</label>
                    <select class="form-select" name="courier" required>
                        <option value="">请选择快递公司</option>
                        <option value="sf">顺丰速运</option>
                        <option value="zt">中通快递</option>
                        <option value="yd">韵达快递</option>
                        <option value="ems">EMS</option>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label">快递单号</label>
                    <input type="text" class="form-input" name="trackingNumber" 
                           placeholder="请输入快递单号" required
                           pattern="[A-Za-z0-9]{6,32}"
                           title="快递单号应为6-32位字母数字组合">
                </div>
                <div class="form-group">
                    <label class="form-label">备注信息（选填）</label>
                    <input type="text" class="form-input" name="remark"
                           placeholder="请输入备注信息">
                </div>
                <button type="submit" class="submit-btn">确认发货</button>
            </form>
        </div>
    </div>

    <script>
    // 页面加载时获取订单号
    document.addEventListener('DOMContentLoaded', function() {
        const urlParams = new URLSearchParams(window.location.search);
        const orderNumber = urlParams.get('order');
        if (orderNumber) {
            document.getElementById('orderNumber').textContent = orderNumber;
        }
    });

    // 表单提交处理
    function handleSubmit(event) {
        event.preventDefault();
        const form = event.target;
        const formData = new FormData(form);
        const data = Object.fromEntries(formData.entries());

        // 这里添加发货请求的逻辑
        console.log('发货信息：', data);

        // 模拟发货成功
        alert('发货成功！');
        // 返回订单列表页
        history.back();
    }

    // 实时验证表单
    const form = document.getElementById('shipForm');
    const submitBtn = form.querySelector('.submit-btn');

    form.addEventListener('input', function() {
        const isValid = form.checkValidity();
        submitBtn.disabled = !isValid;
    });
    </script>
</body>
</html>